import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

import diaoStore from '../store/diao.js'

// const diaoStore = {
//   state: {
//     firstName: 'yu',
//     lastName: 'hao',
//     name: 'aaaa'
//   },
//   mutations: {
//     name(state) {
//       state.name = state.firstName + ' ' + state.lastName
//     }
//   }
// }
const store = new Vuex.Store({
  modules: {
    diao: diaoStore
  },
  state: {
    firstName: 'zhagn',
    lastName: 'san',
    name: 'aaa',
    info: ''
  },
  getters: {
    getName (state) {
      return state.firstName + 'aaabb ' + state.lastName
    }
  },
  mutations: {
    putName: (state) => {
      state.name = state.firstName + state.lastName
    },
    getInfo: (state, userInfo) => {
      state.info = '账号' + userInfo.user + '密码' + userInfo.password ;
    }
  }
})

export default store
